// pages/goods_list/goods_list.js
import {request} from "../../utils/request"
Page({
  data: {
    goolist:[
    ],tabs:[
      {id:0,name:"经典菜单",isSel:true},
      {id:1,name:"自在厨房",isSel:false},
    ],
    curr:0,
    leftMenulist:[],
    rightContent:[],
    goodId:{},
    cart:[]
    
  },
  onLoad(){
    this.getGood();
  },
   async getGood (){
         let ret = await request ({url:"/TheMenu"})
         console.log("商品",ret);
        let thedata = ret.data.data
         this.setData({
           goolist:thedata});
         console.log(this.data.goolist);

  },
  itemChange(e){
    console.log("这是我第二个1e",e)
    let {i} = e.detail;
    let {tabs} = this.data;
    console.log(i);
    tabs.forEach((v,k)=> k==i? v.isSel=true:v.isSel=false);
    this.setData ({tabs});
  },
  itemCan(e){
    let {index} = e.currentTarget.dataset;
    console.log(index);
    let right = this.data.goolist.MenuTb[0].children[index].children;
    console.log(right,"右侧内容");
    this.setData({
      curr:index,
      rightContent:right
    })

  },
  itemCang(e){
    let {index} = e.currentTarget.dataset;
    console.log(index);
    let right = this.data.goolist.MenuTb[1].children[index].children;
    console.log(right,"右侧内容");
    this.setData({
      curr:index,
      rightContent:right
    })
  },

})